/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2018-12-13 Time: 22:23
 *
 * 我的工单
 */

import React, {Component} from 'react';
import {
    SafeAreaView,
    View,
    Text,
    Image,
    TouchableOpacity,
    ScrollView,
    Modal
} from 'react-native';
import {connect} from 'react-redux';
import {styles} from './RoomRepariRecordScreen.Style'
import {FetchStatus} from "../../../configuration/RequestConfiguration";
import {ReturnStatus} from "../../../configuration/ReturnStatus";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import AntDesign from "react-native-vector-icons/AntDesign";
import {SCREEN_HEIGHT} from "../../../constant/PHScreen";
import {Header} from "react-navigation";

class RoomRepariRecordScreen extends Component {

    static navigationOptions = ({navigation}) => ({
        headerTitle: `工程维修`,
        headerRight: (
            <TouchableOpacity activeOpacity={0.9} onPress={
                // navigation.getParam('setModalVisible')
                ()=>{
                    navigation.navigate('CreateRepairWorkOrderScreen')
                }
            }>
                 <AntDesign name={'plus'} size={30} style={{color: '#212121',marginRight:15}}/>
            </TouchableOpacity>
        )
    });

    // 构造
    constructor(props) {
        super(props);

        // 初始状态
        this.state = {
            Ds:this.props.navigation.getParam("ds"),//客房信息
            orderNum:1,//工单数量

        };

    }

    render() {
        return (
            <SafeAreaView style={styles.body}>

                <ScrollView style={styles.body}>
                    {
                        this.state.orderNum===0
                        ?
                            (
                                <TouchableOpacity activeOpacity={0.8} onPress={() => {
                                    this.props.navigation.navigate('CreateRepairWorkOrderScreen')
                                }}>
                                    <View style={{marginTop:10,marginRight: 15 ,flexDirection: 'column',alignItems: 'center',justifyContent: 'center',height:SCREEN_HEIGHT-Header.HEIGHT-40}}>
                                        <Text style={styles.text}>
                                            当前没有工程维修记录,点击报修
                                        </Text>
                                    </View>
                                </TouchableOpacity>
                            )
                        :
                            (
                                <View style={[styles.container,{marginTop:10}]}>
                                    <View style={styles.orderTop}>
                                        <View style={styles.iconBox}>
                                            <AntDesign name={'infocirlceo'} size={20} style={{color: '#6ba1f9'}}/>
                                        </View>
                                        <View style={styles.textBox}>
                                            <View style={styles.leftBox}>
                                                <Text style={[styles.titleText,{marginLeft:5}]}>
                                                    普通单
                                                </Text>
                                                <Text style={[styles.text,{color:'#6b6b6b',marginLeft:2,marginTop:3}]}>
                                                    （工单号：821681）
                                                </Text>
                                            </View>
                                        </View>
                                        <View style={styles.arrowBox}>
                                            <Text style={[styles.text,{marginTop:3}]}>
                                                未派工
                                            </Text>
                                        </View>
                                    </View>
                                    <View style={styles.orderCenter}>
                                        <View style={styles.orderCenterLine}>
                                            <View style={styles.orderCenterLeft}>
                                                <Text style={styles.orderCenterText}>
                                                    对象
                                                </Text>
                                            </View>
                                            <View style={styles.orderCenterRight}>
                                                <Text style={styles.orderCenterText}>
                                                    地坪漆地面
                                                </Text>
                                            </View>
                                        </View>
                                        <View style={styles.orderCenterLine}>
                                            <View style={styles.orderCenterLeft}>
                                                <Text style={styles.orderCenterText}>
                                                    内容
                                                </Text>
                                            </View>
                                            <View style={styles.orderCenterRight}>
                                                <Text style={styles.orderCenterText}>
                                                    渗水
                                                </Text>
                                            </View>
                                        </View>
                                        <View style={styles.orderCenterLine}>
                                            <View style={styles.orderCenterLeft}>
                                                <Text style={styles.orderCenterText}>
                                                    备注
                                                </Text>
                                            </View>
                                            <View style={styles.orderCenterRight}>
                                                <Text style={styles.orderCenterText}>
                                                    无
                                                </Text>
                                            </View>
                                        </View>
                                        <View style={styles.orderCenterLine}>
                                            <View style={styles.orderCenterLeft}>
                                                <Text style={styles.orderCenterText}>
                                                    报修人
                                                </Text>
                                            </View>
                                            <View style={styles.orderCenterRight}>
                                                <Text style={styles.orderCenterText}>
                                                    admin
                                                </Text>
                                            </View>
                                        </View>
                                        <View style={styles.orderCenterLine}>
                                            <View style={styles.orderCenterLeft}>
                                                <Text style={styles.orderCenterText}>
                                                    进展
                                                </Text>
                                            </View>
                                            <View style={styles.orderCenterRight}>
                                                <Text style={styles.orderCenterText}>
                                                    2018-11-22日报修
                                                </Text>
                                            </View>
                                        </View>
                                    </View>
                                    <View style={styles.orderBottom}>

                                        <TouchableOpacity activeOpacity={0.8} onPress={() => {

                                        }}>
                                            <View style={styles.orderBottomLeft}>
                                                <Text style={styles.orderBottomText}>
                                                    <AntDesign name={'reload1'} size={18} style={{marginRight:5}}/>
                                                    重新维修
                                                </Text>
                                            </View>
                                        </TouchableOpacity>

                                        <TouchableOpacity activeOpacity={0.8} onPress={() => {

                                        }}>
                                            <View style={styles.orderBottomRight}>
                                                <Text style={styles.orderBottomText}>
                                                    <AntDesign name={'checkcircleo'} size={18} style={{marginRight:5}}/>
                                                    验收通过
                                                </Text>
                                            </View>
                                        </TouchableOpacity>

                                    </View>
                                </View>
                            )
                    }


                </ScrollView>


            </SafeAreaView>
        )
    }

}

const props = state => {
    return {

    }
}

export default RoomRepariRecordScreen = connect(props)(RoomRepariRecordScreen);